<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:replace="common/head"/>
</head>
<body>
<div class="x-body">
    <form class="layui-form layui-form-pane" action="/goods/doEdit">
        <input type="hidden" id="img" name="imgFile">
        <input type="hidden" name="goodsImg" th:value="${myEntity.goodsImg}">
        <input type="hidden" name="goodsId" th:value="${myEntity.goodsId}">
        <div class="layui-form-item">
            <label class="layui-form-label">商品编码</label>
            <div class="layui-input-block" style="width: 300px">
                <input type="text" name="goodsCode" lay-verify="required|checkPlusInt" placeholder="必填,正整数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.goodsCode}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品名称</label>
            <div class="layui-input-block" style="width: 300px">
                <input type="text" name="goodsName" lay-verify="required" placeholder="必填" autocomplete="off"
                       class="layui-input" th:value="${myEntity.goodsName}">
            </div>
        </div>
        <div class="layui-inline" style="margin-bottom: 15px">
            <label class="layui-form-label">商品类型</label>
            <div class="layui-input-inline" style="width: 300px">
                <select name="goodsType" lay-verify="required" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${goodsType}">
                        <option th:value="${map.key}" th:text="${map.value}" th:selected="${myEntity.goodsType==map.key}"></option>
                    </th:block>
                </select>
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">销售属性</label>
            <div class="layui-input-block">
                <th:block lay-verify="required" th:each="map: ${saleType}">
                    <input type="radio" name="saleType" th:value="${map.key}" th:title="${map.value}" th:checked="${myEntity.saleType}==${map.key}">
                </th:block>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">库存量</label>
            <div class="layui-input-block" style="width: 300px">
                <input type="text" name="stockCount" lay-verify="required|checkDec" placeholder="必填,正数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.stockCount}">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">包装类型</label>
            <div class="layui-input-block">
                <th:block lay-verify="required" th:each="map: ${unitType}">
                    <input type="radio" name="unitType" th:value="${map.key}" th:title="${map.value}" th:checked="${myEntity.unitType}==${map.key}">
                </th:block>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">每份的重量</label>
            <div class="layui-input-block" style="width: 300px">
                <input type="text" name="weight" lay-verify="required|checkDec" placeholder="必填,正数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.weight}">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">重量单位</label>
            <div class="layui-input-block">
                <th:block lay-verify="required" th:each="map: ${weightType}">
                    <input type="radio" name="weightType" th:value="${map.key}" th:title="${map.value}" th:checked="${myEntity.weightType}==${map.key}">
                </th:block>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">进价/成本价</label>
            <div class="layui-input-block" style="width: 300px">
                <input type="text" name="originalPrice" lay-verify="required|checkDec" placeholder="必填,正数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.originalPrice}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">批发价</label>
            <div class="layui-input-inline" style="width: 300px">
                <input type="text" name="wholesalePrice" lay-verify="checkDec" placeholder="非必填,正数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.wholesalePrice}">
            </div>
            <div class="layui-form-mid layui-word-aux">原料，非卖品不用填</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">零售价</label>
            <div class="layui-input-inline" style="width: 300px">
                <input type="text" name="retailPrice" lay-verify="checkDec" placeholder="非必填,正数" autocomplete="off"
                       class="layui-input" th:value="${myEntity.retailPrice}">
            </div>
            <div class="layui-form-mid layui-word-aux">原料，非卖品不用填</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品图片</label>
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="uploadImg">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="imgElement" th:src="${myEntity.goodsImg}" lay-verify="checkImg">
                    <p id="imgDesc"></p>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" style="margin-left:200px;" lay-submit lay-filter="submit">提交</button>
                <button class="layui-btn layui-btn-primary" id="deleteImg" th:attr="data-id=${myEntity.goodsId}" data-url="/goods/deleteImg">删除图片</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<div th:replace="common/js"></div>
<div th:replace="common/setting"></div>
<script type="text/javascript">
    layui.use('xform');
    layui.use('xupload');
</script>
</body>
</html>
